<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:csharp="http://csharp.org" xsi:schemaLocation="urn:oasis:names:tc:emergency:EDXL:HAVE:1.0 edxl-have_pr3.xsd" xmlns:cap="urn:oasis:names:tc:emergency:cap:1.2" xmlns:have="urn:oasis:names:tc:emergency:EDXL:HAVE:1.0" xmlns:de="urn:oasis:names:tc:emergency:EDXL:DE:1.0" xmlns:rmsg="urn:oasis:names:tc:emergency:EDXL:RM:1.0:msg" xmlns:rm="urn:oasis:names:tc:emergency:EDXL:RM:1.0" xmlns:n3="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xal="urn:oasis:names:tc:ciq:xal:3" xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3" xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
	
	<xsl:import href="GML Scripts.xsl"/>
	
	<xsl:output method="html" indent="yes" exclude-result-prefixes="msxsl csharp"/>


	<xsl:template name="ContactInformationType">
		<table  bordercolor="#ababab" border="2px" cellpadding="3" cellspacing="0" width="750">
			<tr>
				<td style="vertical-align:top" colspan="4" >
					<table bordercolor="#ababab" border="0px" cellpadding="3" cellspacing="0" width="750">
						<tr>
							<td colspan="1" bgcolor="#F2F2F2">
								<xsl:if test="rm:ContactDescription">
									<b>Contact Description: </b>
									<xsl:value-of select="rm:ContactDescription"/>
								</xsl:if>
							</td>
							
							<td colspan="1" bgcolor="#F2F2F2">
								<xsl:if test="rm:ContactRole">
									<b>Contact Role: </b>
									<xsl:value-of select="rm:ContactRole"/>
								</xsl:if>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			
			<tr  VALIGN="TOP">
				<td colspan="1" bgcolor="#F2F2F2">
					<table  bordercolor="#ababab" border="1px" cellpadding="10" cellspacing="0" width="200">
						<tr>
							<th>Radio Information</th>
						</tr>
						<tr>
							<td>
								<xsl:for-each select="rm:Radio">
									<b>Channel: </b>
									<xsl:value-of select="rm:RadioChannel"/>
									
									<center>
										<xsl:for-each select="rm:RadioType">
											<xsl:call-template name="ValueListType"/>
										</xsl:for-each>
									</center>
									<br/>
									<hr/>
								</xsl:for-each>
							</td>
						</tr>
					</table>
				</td>	
						
				<td colspan="3"  bgcolor="#F2F2F2">
							
							<xsl:for-each select="rm:ContactLocation">
								<center>
									<xsl:if test="rm:LocationDescription">
										<i><b><br/>Location Description: </b><xsl:value-of select="rm:LocationDescription"/></i><br/>
									</xsl:if>							
								
									<xsl:if test="rm:TargetArea">
										<xsl:call-template name="TargetArea"/>
									</xsl:if>
								
									<br/>
								
									<xsl:if test="rm:Address">
										<xsl:call-template name="Address"/>
									</xsl:if>
									<xsl:if test="rm:Attributes">
											<br/>Attributes not handled yet<br/>
									</xsl:if>
								</center>
								
								
							</xsl:for-each>
				</td>
			</tr>
		</table>
	</xsl:template>
	
	
	
	
	
	
	
	
	
	
	<xsl:template name="QuantityReport" match="*">
		
		<xsl:for-each select="rm:QuantityText">
			<xsl:value-of select="."/>
			<br/>
		</xsl:for-each>
		<xsl:if test="rm:MeasuredQuantity">
			<b>Amount: </b>
			<xsl:value-of select="rm:MeasuredQuantity/rm:Amount"/>
			<br/>
			<xsl:for-each select="rm:MeasuredQuantity/rm:UnitOfMeasure">
				<xsl:call-template name="ValueListType"/>
			</xsl:for-each>
		</xsl:if>
	</xsl:template>
	
	
	
	
	
	
	
	<xsl:template name="ValueListType" match="*">
		<table  bordercolor="#ababab" border="1px" cellpadding="4" cellspacing="0" width="120">
			<tr>
				<th><b><xsl:value-of select="rm:ValueListURN"/></b></th>
			</tr>
			
			<xsl:for-each select="rm:Value">
				<tr>
					<td><xsl:value-of select="."/></td>
				</tr>
			</xsl:for-each>
			
		</table>
	</xsl:template>
	
	
	
	<xsl:template name="Address" match="*">
		<table bordercolor="#ababab" bgcolor="#FFFFFF" border="1px" cellpadding="3" cellspacing="0" >
		
			<xsl:if test="rm:Address/xal:FreeTextAddress">
				<tr>
					<td colspan="1">
						<b>Address</b>
					</td>
					
					<td colspan="3">
							<xsl:for-each select="rm:Address/xal:FreeTextAddress/xal:AddressLine">
								<xsl:value-of select="."/>
								<br/>
							</xsl:for-each>
					</td>
				</tr>	
			</xsl:if>
			
			<xsl:if test="rm:Address/xal:Country">
				<tr>
					<td colspan="1">
						<b>Country</b>
					</td>
					
					<td colspan="3">
						<xsl:value-of select="rm:Address/xal:Country/xal:NameElement"/>
					</td>
				</tr>
			</xsl:if>
			
			<xsl:if test="rm:Address/xal:Locality">
				<tr>
					<td colspan="1">
						<b>Locality</b>
					</td>
					<td colspan="3">
						<xsl:for-each select="rm:Address/xal:Locality/xal:NameElement">
							<xsl:value-of select="."/>
							<br/>
						</xsl:for-each>
					</td>
				</tr>	
			</xsl:if>
			
			<xsl:if test="rm:Address/xal:Locality/xal:SubLocality">
				<tr>
					<td colspan="1">
						<b>Sub-Locality</b>
					</td>
					<td colspan="3">
						<xsl:for-each select="rm:Address/xal:Locality/xal:SubLocality/xal:NameElement">
							<xsl:value-of select="."/>
							<br/>
						</xsl:for-each>
					</td>
				</tr>
			</xsl:if>
			
				<xsl:if test="rm:Address/xal:Thoroughfare">
					<tr>
						<td colspan="1">
							<b>Thoroughfare</b>
						</td>
						<td  colspan="3">
							<xsl:if test="rm:Address/xal:Thoroughfare/xal:NameElement">
								<b>Name: </b>
								<xsl:value-of select="rm:Address/xal:Country/xal:NameElement"/>
								<br/>
							</xsl:if>
							<xsl:if test="rm:Address/xal:Thoroughfare/xal:Number">
								<b>Number: </b>
								<xsl:value-of select="rm:Address/xal:Country/xal:Number"/>
							</xsl:if>
						</td>
					</tr>
				</xsl:if>
				
				
				<xsl:if test="rm:Address/xal:PostCode">
					<tr>
						<td colspan="1">
							<b>Post Code</b>
						</td>
						<td colspan="3">
							<xsl:for-each select="rm:Address/xal:PostCode/xal:Identifier">
								<xsl:value-of select="."/>
								<br/>
							</xsl:for-each>
						</td>
					</tr>
				</xsl:if>
				
				<xsl:if test="rm:Address/xal:AdministrativeArea">
					<tr>
						<td colspan="1">
							<b>Administrative Area</b>
						</td>
						<td colspan="3">
							<xsl:for-each select="rm:Address/xal:AdministrativeArea/xal:NameElement">
								<xsl:value-of select="."/>
								<br/>
							</xsl:for-each>
						</td>
					</tr>
				</xsl:if>	
				
				<xsl:if test="rm:Address/xal:AdministrativeArea/xal:SubAdministrativeArea">
					<tr>
						<td colspan="1">
							<b>Sub-Administrative Area</b>
						</td>
						<td colspan="3">
							<xsl:for-each select="rm:Address/xal:AdministrativeArea/xal:SubAdministrativeArea/xal:NameElement">
								<xsl:value-of select="."/>
								<br/>
							</xsl:for-each>
						</td>
					</tr>
				</xsl:if>	
				
		</table>
	</xsl:template>
	
	
	
	
	<xsl:template name="TargetArea" match="*">
		<xsl:for-each select="rm:TargetArea">
			<xsl:call-template name="DrawArea"/>
		</xsl:for-each>
	</xsl:template>
	

	
	
	<xsl:template match="*">
		<HTML>
			<HEAD>
				<STYLE TYPE="text/css">
						.indented
						   {
						   padding-left: 50pt;
						   padding-right: 50pt;
						   }
						   
						  .indented2
						   {
						   padding-left: 75pt;
						   padding-right: 50pt;
						   }
						   
						   .indented3
						   {
						   padding-left: 100pt;
						   padding-right: 50pt;
						   }
						   
						   .indented4
						   {
						   padding-left: 125pt;
						   padding-right: 50pt;
						   }
					</STYLE>
				<style type="text/css">
					  #map-canvas {
						height: 500px;
					  }
					</style>

        <script type="text/javascript">
          <xsl:value-of select="document('CommonJavascript.js')" disable-output-escaping="yes" />
        </script>
				<TITLE>RM Message</TITLE>
				<link rel="stylesheet" media="screen" type="text/css" href="css/style.css"/>
			</HEAD>
			<BODY>

				<table bordercolor="#ababab" border="1px" cellpadding="10" cellspacing="0" width="1000">
				<tr>
					<td colspan="1">
						<b>Message ID: </b>
							<xsl:value-of select="rmsg:MessageID"/>
						</td>
						
						<td colspan="1">
							<b>Sent Date Time: </b>
							<script type="text/javascript">
								document.write(TimeStampToDate("<xsl:value-of select="rmsg:SentDateTime"/>"));			
							</script>
						</td>
				</tr>
				
				<tr> 
					<td colspan="1" width="50%">
						<b>Content Type: </b>
						<xsl:value-of select="rmsg:MessageContentType"/>
						<br/>
						
						
						
						<b>Originating Message ID: </b>
						<xsl:value-of select="rmsg:OriginatingMessageID"/>
						<br/>

						<xsl:if test="rmsg:PrecedingMessageID">
							<b>Preceding Message ID: </b>
							<xsl:value-of select="rmsg:PrecedingMessageID"/>
							<br/>
						</xsl:if>
						<hr/>
						<xsl:if test="rmsg:MessageRecall">
							<b>Message Recall ID: </b><xsl:value-of select="rmsg:MessageRecall/rm:RecallMessageID"/>
							<b>, Type: </b>
							<xsl:value-of select="rmsg:MessageRecall/rm:RecallType"/>
						</xsl:if>
					</td>
					<td colspan="1">
						<xsl:if test="rmsg:MessageDescription">
							<b>Description: </b>
							<xsl:value-of select="rmsg:MessageDescription"/>
							<br/>
						</xsl:if>
					</td>
				</tr>
				
				<tr>
					
					<td colspan="1">
						<xsl:for-each select="rmsg:IncidentInformation">
							<xsl:if test="rm:IncidentID">
								<b>Incident ID: </b>
								<xsl:value-of select="rm:IncidentID"/>
							</xsl:if>
							<xsl:if test="rm:IncidentDescription">
								<b> - Description: </b>
								<xsl:value-of select="rm:IncidentDescription"/>
							</xsl:if>
							<br/>
						</xsl:for-each>
					</td>
					<td colspan="1">
						<xsl:for-each select="rmsg:Funding">
							<xsl:if test="rm:FundCode">
								<b>Fund Code: </b>
								<xsl:value-of select="rm:FundCode"/>
							</xsl:if>
							<xsl:if test="rm:FundingInfo">
								<b> - </b>
								<xsl:value-of select="rm:FundingInfo"/>
							</xsl:if>
							<br/>
						</xsl:for-each>
					</td>
				</tr>	
				
				<tr>
					<td colspan="2">
						
						
						<br/>
						
						
						<xsl:for-each select="rmsg:ContactInformation">
							<b>CONTACT INFORMATION:</b><br/>
							<xsl:call-template name="ContactInformationType"/>
							<hr/>
						</xsl:for-each>
						<hr/>
						
						
						<xsl:for-each select="rmsg:ResourceInformation">
							<table bgcolor="#DBFFFE"  bordercolor="#ABABCC" border="2px" cellpadding="10" cellspacing="0" width="950">
								<tr>
									<td colspan="2">
										<h2><u>Resource Information ID</u>: <xsl:value-of select="rmsg:ResourceInfoElementID"/></h2>
									</td>
								</tr>
								<tr VALIGN="TOP">
									
									<td colspan="1">
										<xsl:if test="rmsg:ResponseInformation">
											<xsl:if test="rmsg:ResponseInformation/rm:PrecedingResourceInfoElementID">
												<b>Preceding Resource Info Element ID: </b>
												<xsl:value-of select="rmsg:ResponseInformation/rm:PrecedingResourceInfoElementID"/>
												<br/>
											</xsl:if>
											<xsl:if test="rmsg:ResponseInformation/rm:ResponseType">
												<b>Response Type: </b>
												<xsl:value-of select="rmsg:ResponseInformation/rm:ResponseType"/>
											</xsl:if>
											<br/>
											<hr/>
											<xsl:if test="rmsg:ResponseInformation/rm:ResponseReason">
												<b>Response Reason: </b>
												<xsl:value-of select="rmsg:ResponseInformation/rm:ResponseReason"/>
												<br/>
											</xsl:if>
										</xsl:if>
									</td>
									<td colspan="1">
										<xsl:if test="rmsg:ResponseInformation">
											
											
											<xsl:for-each select="rmsg:ResponseInformation/rm:ReasonCode">
												<b><u>Reason Codes</u></b><br/>
												<xsl:call-template name="ValueListType"/>
											</xsl:for-each>
										</xsl:if>
									</td>
											
											
									<br/>
										
									
								</tr>
								
								<tr>
									<td colspan="2">		
										<xsl:if test="rmsg:Resource">
											<h2><u>Resource</u>: 
												<xsl:if test="rmsg:Resource/rmsg:ResourceStatus">
													<xsl:value-of select="rmsg:Resource/rmsg:ResourceID"/>
												</xsl:if>
												<xsl:if test="rmsg:Resource/rmsg:Name">
													<b>, </b><u>Name</u>: <xsl:value-of select="rmsg:Resource/rmsg:Name"/>
												</xsl:if>
											</h2>

											<table cellpadding="10" cellspacing="0">
												<tr VALIGN="TOP">
													<td>
														<xsl:if test="rmsg:Resource/rmsg:Keyword">
															<b>Resource Keywords: </b>
															
															<xsl:for-each select="rmsg:Resource/rmsg:Keyword">
																<xsl:call-template name="ValueListType"/>
															</xsl:for-each>
														</xsl:if>
																						
																						
														<xsl:if test="rmsg:Resource/rmsg:TypeStructure">
															<br/>
															<b>Type Structure: </b>
															<br/>
															<xsl:for-each select="rmsg:Resource/rmsg:TypeStructure">
																<xsl:call-template name="ValueListType"/>
															</xsl:for-each>
														</xsl:if>
														
														
														<xsl:if test="rmsg:Resource/rmsg:ResourceStatus">
															<xsl:if test="rmsg:Resource/rmsg:ResourceStatus/rmsg:Availability">
																<br/>
																<b>Availability: </b><br/>
																<xsl:value-of select="rmsg:Resource/rmsg:ResourceStatus/rmsg:Availability"/>
																<br/>
															</xsl:if>
															<br/>
															<xsl:for-each select="rmsg:Resource/rmsg:ResourceStatus/rmsg:DeploymentStatus">
																<b>Deployment: </b>
																<br/>
																<xsl:call-template name="ValueListType"/>
															</xsl:for-each>
														</xsl:if>
													</td>	
													
													<td>
																								
														
														<br/>
														
														<xsl:if test="rmsg:Resource/rmsg:Description">
															<b>Description: </b>
															<xsl:value-of select="rmsg:Resource/rmsg:Description"/>
															<br/>
														</xsl:if>
														
														<xsl:if test="rmsg:Resource/rmsg:TypeInfo">
															<xsl:for-each select="rmsg:Resource/rmsg:TypeInfo/*">
																<b>Type: </b>
																<xsl:value-of select="."/>
																<br/>
															</xsl:for-each>
															<br/>
														</xsl:if>
														
														
														<xsl:if test="rmsg:Resource/rmsg:Credentials">
															<b>Credentials: </b>
															<xsl:value-of select="rmsg:Resource/rmsg:Credentials"/>
															<br/>
														</xsl:if>
														
														<xsl:if test="rmsg:Resource/rmsg:Certifications">
															<b>Certifications: </b>
															<xsl:value-of select="rmsg:Resource/rmsg:Certifications"/>
															<br/>
														</xsl:if>
														
														<xsl:if test="rmsg:Resource/rmsg:SpecialRequirements">
															<b>Special Requirements: </b>
															<xsl:value-of select="rmsg:Resource/rmsg:SpecialRequirements"/>
															<br/>
														</xsl:if>
														
														
														<xsl:if test="rmsg:Resource/rmsg:OwnershipInformation">
															<b>Ownership Information </b>
															<br/>
															<xsl:if test="rmsg:Resource/rmsg:OwnershipInformation/rm:Owner">
																<b>Ownership Information: </b>
																<xsl:value-of select="rmsg:Resource/rmsg:OwnershipInformation/rm:Owner"/>
																<br/>
															</xsl:if>
															<xsl:if test="rmsg:Resource/rmsg:OwnershipInformation/rm:OwningJurisdiction">
																<b>Owning Jurisdiction: </b>
																<xsl:value-of select="rmsg:Resource/rmsg:OwnershipInformation/rm:OwningJurisdiction"/>
																<br/>
															</xsl:if>
															<xsl:if test="rmsg:Resource/rmsg:OwnershipInformation/rm:HomeDispatch">
																<b>Home Dispatch: </b>
																<xsl:value-of select="rmsg:Resource/rmsg:OwnershipInformation/rm:HomeDispatch"/>
																<br/>
															</xsl:if>
															<xsl:if test="rmsg:Resource/rmsg:OwnershipInformation/rm:HomeUnit">
																<b>Home Unit: </b>
																<xsl:value-of select="rmsg:Resource/rmsg:OwnershipInformation/rm:HomeUnit"/>
																<br/>
															</xsl:if>
														</xsl:if>
														
														
														
														<br/>
											
														<xsl:for-each select="rmsg:Resource/rmsg:ResponsibleParty">
															<br/><br/><b>Responsible Party: </b>
															<br/>
															<xsl:call-template name="ContactInformationType"/>
														</xsl:for-each>
													</td>
												</tr>
											</table>
											
											
											
											
											
											
											
											
											
											
											

											
											
										</xsl:if>
									</td>
								</tr>
								
								<tr>
									<td colspan="2">	
										<xsl:if test="rmsg:AssignmentInformation">
											<h2>Assignment Information:<br/></h2>
												<table width="70%" cellpadding="10">
													<tr>
														<td>
															<b>Order ID: </b>
															<xsl:value-of select="rmsg:AssignmentInformation/rmsg:OrderID"/>
															<br/>
															
															<b>Restrictions: </b>
															<xsl:value-of select="rmsg:AssignmentInformation/rmsg:Restrictions"/>
															<br/>
															<b>Anticipated Function: </b>
															<xsl:value-of select="rmsg:AssignmentInformation/rmsg:AnticipatedFunction"/>
														</td>
														
														<td>
															<xsl:if test="rmsg:AssignmentInformation/rmsg:AssignmentInstructions">
																
																<table bordercolor="#ababab" border="0px" cellpadding="3" cellspacing="0" >
																	<tr>
																		<td colspan="2"><u><b>Instructions:</b></u></td>
																	</tr>
																	<tr>
																		<xsl:if test="rmsg:AssignmentInformation/rmsg:AssignmentInstructions/rm:ModeOfTransportation">
																			<td><b>Mode of Transportation: </b></td>
																			<td><xsl:value-of select="rmsg:AssignmentInformation/rmsg:AssignmentInstructions/rm:ModeOfTransportation"/></td>
																		</xsl:if>
																	</tr>
																	<tr>
																		<xsl:if test="rmsg:AssignmentInformation/rmsg:AssignmentInstructions/rm:NavigationInstructions">
																			<td><b>Navigation Instructions: </b></td>
																			<td><xsl:value-of select="rmsg:AssignmentInformation/rmsg:AssignmentInstructions/rm:NavigationInstructions"/></td>
																		</xsl:if>
																	</tr>
																	<tr>
																		<xsl:if test="rmsg:AssignmentInformation/rmsg:AssignmentInstructions/rm:ReportingInstructions">
																			<td><b>Reporting Instructions: </b></td>
																			<td><xsl:value-of select="rmsg:AssignmentInformation/rmsg:AssignmentInstructions/rm:ReportingInstructions"/></td>
																		</xsl:if>
																	</tr>
															</table>
																
															</xsl:if>	
														</td>
													</tr>
													<tr valign="top">
														<td>
															<xsl:for-each select="rmsg:AssignmentInformation/rmsg:Quantity">
																<u><b>Quantity: </b></u><br/>
																<xsl:call-template name="QuantityReport"/>
															</xsl:for-each>
														</td>
														
														<td>
															<xsl:for-each select="rmsg:AssignmentInformation/rmsg:PriceQuote">
																<u><b>Price Quote: </b></u><br/>
																<xsl:call-template name="QuantityReport"/>
															</xsl:for-each>
														</td>
													</tr>
												</table>		
														
														
														
														
														
														
														
														
													
													
										</xsl:if>
									</td>
								</tr>
								
								<tr>
									<td colspan="2">	
										<xsl:for-each select="rmsg:ScheduleInformation">
											<table bgcolor="#8EDEDD" bordercolor="#ababab" border="1px" cellpadding="1" cellspacing="0" >
												<tr>
													<td  colspan="4">
													
														<table bordercolor="#ababab" border="0px" cellpadding="1" cellspacing="0" >
															<tr>
																<td>
																	<h3>
																		<b>Schedule of type: </b>
																		<xsl:value-of select="rmsg:ScheduleType"/>
																	</h3>
																</td>
																<td>
																	<h3>
																		<xsl:if test="rmsg:DateTime">
																			<script type="text/javascript">
																				document.write(TimeStampToDate("<xsl:value-of select="rmsg:DateTime"/>"));			
																			</script>
																		</xsl:if>
																	</h3>
																</td>
															</tr>
														</table>
														
													</td>
												</tr>
												<tr>
													<xsl:if test="rmsg:Location">
														<td  colspan="3">
																<xsl:if test="rmsg:Location/rm:TargetArea">
																	<xsl:for-each select="rmsg:Location">
																		<xsl:call-template name="TargetArea"/>
																	</xsl:for-each>
																</xsl:if>
														</td>
														<td align="center"  colspan="1">
																<xsl:if test="rmsg:Location/rm:LocationDescription">
																	
																	<i><b>Location Description: </b>
																	<xsl:value-of select="rmsg:Location/rm:LocationDescription"/>
																	</i>
																	<br/><br/>
																</xsl:if>
																<xsl:if test="rmsg:Location/rm:Address">
																	<xsl:for-each select="rmsg:Location">
																		<xsl:call-template name="Address"/>
																	</xsl:for-each>
																	
																</xsl:if>
																
														</td>
													</xsl:if>
												</tr>
											</table>
											<br/>
										</xsl:for-each>
									</td>
								</tr>
							</table>	
							
							<br/>
							<br/>
						</xsl:for-each>
					
					</td>
				</tr>
				</table>
			</BODY>
		</HTML>
	</xsl:template>
</xsl:stylesheet>
